/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.app.service.buyer;

import com.shop.cereshop.app.domain.buyer.BuyerSearchVO;
import com.shop.cereshop.commons.domain.buyer.CereBuyerSearch;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.result.Result;

import java.util.List;

public interface CereBuyerSearchService {
    List<CereBuyerSearch> getHistory(Long buyerUserId);

    void insert(CereBuyerSearch cereBuyerSearch) throws CoBusinessException;

    void delete(Long searchId);

    CereBuyerSearch findBySearch(String search, Long buyerUserId,Integer SearchType);

    void updateBuyerData(Long buyerUserId, Long id) throws CoBusinessException;

    List<String> selectHotSearch();

    void save(Long buyerUserId, String keyword, Integer searchType);

    /**
     * 查询用户搜索记录（取最新10条）
     * @param buyerUserId 用户ID
     * @param searchType  搜索类型（1-商品,2-店铺,3-购物车）
     * @return 用户搜索记录
     */
    Result<List<BuyerSearchVO>> getBuyerSearchList(Long buyerUserId, Integer searchType);

    /**
     * 查询用户搜索热门记录（取100条，相同频次时按搜索词排序，同一搜索词内，最新记录（ID大）在前）
     * @param buyerUserId 用户ID
     * @param searchType  搜索类型（1-商品,2-店铺,3-购物车）
     * @return 用户搜索记录
     */
    Result<List<BuyerSearchVO>> getUserHotSearch(Long buyerUserId, Integer searchType);

    /**
     * 删除用户搜索记录
     * @param buyerUserId 用户ID
     * @param searchId 搜索记录ID
     * @return 删除结果
     */
    Result<Void> deleteBuyerSearch(Long buyerUserId, Long searchId);

    /**
     * 根据类型 删除用户搜索记录
     * @param buyerUserId 用户ID
     * @param searchType 搜索类型（1-商品,2-店铺,3-购物车）
     * @return 删除结果
     */
    Result<Void> deleteBuyerAllSearch(Long buyerUserId, Integer searchType);
}
